//
//  SinaStatusViewModel.m
//  oc微博
//
//  Created by 安陆与 on 16/1/20.
//  Copyright © 2016年 安陆与. All rights reserved.
//

#import "SinaStatusViewModel.h"
#import "SinaStatusModel.h"

@implementation SinaStatusViewModel

-(NSURL *)profile_URL{

    return [NSURL URLWithString:_model.user.profile_image_url];
}

//转发
-(NSString *)reposts_string{

    return _model.reposts_count == 0 ? @"转发":[NSString stringWithFormat:@"转发%d",_model.reposts_count];
}


//评论
-(NSString *)comments_string{
    return _model.comments_count == 0 ? @"评论":[NSString stringWithFormat:@"评论%d",_model.comments_count];
}

//表态
-(NSString *)attitudes_string{

    return _model.attitudes_count == 0 ? @"赞":[NSString stringWithFormat:@"%d",_model.attitudes_count];
}

-(UIImage *)verifited_Image{

    switch (_model.user.verified_level - 1) {
        case -1:
            return nil;
            
        case 0:
            return [UIImage imageNamed:@"avatar_vip"];
            
        case 2:
        case 3:
        case 5:
            return [UIImage imageNamed:@"avatar_enterprise_vip"];
            
        case 220:
            return [UIImage imageNamed:@"avatar_grassroot"];
        default:
            return nil;
    }
}

-(UIImage *)vipLevel_Imaeg{

    NSString *str = [NSString stringWithFormat:@"common_icon_membership_level%d",_model.user.mbrank];
    
    return [UIImage imageNamed:str];
}

-(NSArray *)pic_urls{

    NSMutableArray *marray = [NSMutableArray array];
    
    for (NSDictionary *dict in self.model.pic_urls) {
        NSString *str = dict[@"thumbnail_pic"];
        
        NSURL *url = [NSURL URLWithString:str];
        
        [marray addObject:url];
    }
    return marray;
}

-(NSString *)source_string{

    return @"来源";
}

-(NSString *)createdat_string{

    return @"时间";
}

//-(SinaStatusViewModel *)retweeted_status{
//
//    SinaStatusViewModel *ret = [[SinaStatusViewModel alloc]init];
//    
//    ret.model = self.model.retweeted_status;
//    
//    return ret;
//}


-(instancetype)init:(SinaStatusModel *)statuModel{

    if (self = [super init]) {
        _model = statuModel;
    }
    
    return self;

}

@end






